local Lua__heishuo = fk.CreateSkill {

  name = "Lua__heishuo",

  tags = { Skill.Compulsory, },

}

Fk:loadTranslationTable{
    
    ["Lua__heishuo"] = "黑说",
    [":Lua__heishuo"] = "锁定技，你于出牌阶段内：使用的前三张【杀】不计入次数限制；每有一张【杀】造成伤害令所有【杀】伤害基数加一；当你使用装备牌时摸X张牌。(X为你装备区内牌的数量)",
    ["@heishuo_count-phase"] = "黑说",
    ["@heishuo_damage-phase"] = "黑说伤害+",
    
}

Lua__heishuo:addEffect(fk.CardUsing, {
    anim_type = "offensive",
    can_trigger = function(self, event, target, player, data)
        if player:hasSkill(Lua__heishuo.name) then 
            if data.card.type == Card.TypeEquip then
                return target == player and player.phase == Player.Play and #player:getCardIds(Player.Equip) > 0
            end
            if data.card.trueName == "slash" then
                return target == player and player:getMark("@heishuo_count-phase") < 3 and player.phase == Player.Play
            end
        end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local equip_count = #player:getCardIds(Player.Equip)
        if data.card.type == Card.TypeEquip then
            player:drawCards(equip_count, Lua__heishuo.name)
        end
        if data.card.trueName == "slash" then
            player.room:addPlayerMark(player, "@heishuo_count-phase", 1)
            player:addCardUseHistory(data.card.trueName, -1)
        end
    end,
})
Lua__heishuo:addEffect(fk.Damage, {
    is_delay_effect = true,
    mute = true,
    anim_type = "offensive",
    can_trigger = function(self, event, target, player, data)
        if player:hasSkill(Lua__heishuo.name) and data.card then 
            if data.card.trueName == "slash" then
                return target == player and player.phase == Player.Play
            end
        end
    end,
    on_use = function(self, event, target, player, data)
        player.room:addPlayerMark(player, "@heishuo_damage-phase", 1)
    end,
})

Lua__heishuo:addEffect(fk.TargetSpecifying, {
    mute = true,
    is_delay_effect = true,
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(Lua__heishuo.name) and data.from == player and data.card.trueName == "slash" and
               player:getMark("@heishuo_damage-phase") > 0
    end,
    on_use = function(self, event, target, player, data)
        data.additionalDamage = (data.additionalDamage or 0) + player:getMark("@heishuo_damage-phase")
    end,
})

return Lua__heishuo